package com.tyqx.hashchainbiz.controller;

import com.tyqx.hashchainbiz.service.SystemConfigService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/systemConfig")
@CrossOrigin
public class SystemConfigController {

    @Resource
    private SystemConfigService systemConfigService;

    /*@RequestMapping(value = "/addSystemConfig", method = RequestMethod.POST,
            produces = "application/json")
    @ResponseBody
    public Dto addSystemConfig(@RequestBody SystemConfig systemConfig) throws Exception {
        String configKey=systemConfig.getConfigKey();
        SystemConfig systemConfig1=systemConfigService.selectSystemConfigByKey(configKey);
        if(EmptyUtils.isNotEmpty(systemConfig1)){
            return DtoUtil.returnFail("key 已使用","100001");
        }

        Integer flag=systemConfigService.addSystemConfig(systemConfig);
        if(flag>0){
            return DtoUtil.returnSuccess("添加成功");
        }else{
            return DtoUtil.returnFail("添加失败","100002");
        }
    }*/

    /*@RequestMapping(value = "/selectSystemConfigByKey", method = RequestMethod.POST,
            produces = "application/json")
    @ResponseBody
    public Dto selectSystemConfigByKey(@RequestParam(value = "configKey",required = true)String configKey) throws Exception {
        SystemConfig systemConfig=systemConfigService.selectSystemConfigByKey(configKey);
        if(EmptyUtils.isNotEmpty(systemConfig)){
            return  DtoUtil.returnSuccess("查询成功",systemConfig);
        }else{
            return DtoUtil.returnFail("未查询到记录","100001");
        }
    }*/

    /*@RequestMapping(value = "/updateConfigValueByKey", method = RequestMethod.POST,
            produces = "application/json")
    @ResponseBody
    public Dto updateConfigValueByKey(@RequestBody SystemConfig systemConfig) throws Exception {
        Integer flag=systemConfigService.updateConfigValueByKey(systemConfig);
        if(flag>0){
            return  DtoUtil.returnSuccess("更新成功");
        }else{
            return DtoUtil.returnFail("更新失败","100001");
        }
    }*/
}
